bitkeeper revision 1.1504 (428f10aaD4iY_Mj4uu6RLDmF65qx-w)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sat, 21 May 2005 10:42:50 +0000 (10:42 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sat, 21 May 2005 10:42:50 +0000 (10:42 +0000)
Fix memory scrubbing to deal with memguarded Xen heap pages.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/page_alloc.c

index c320d751748e0b7e463ea7068d512b82f824061d..72b25bd0ea463682e650575d7734479620c156a7 100644 (file)
@@ -375,9 +375,19 @@ void scrub_heap_pages(void)
         /* Re-check page status with lock held. */
         if ( !allocated_in_map(pfn) )
         {
-            p = map_domain_mem(pfn << PAGE_SHIFT);
-            clear_page(p);
-            unmap_domain_mem(p);
+            if ( IS_XEN_HEAP_FRAME(pfn_to_page(pfn)) )
+            {
+                p = page_to_virt(pfn_to_page(pfn));
+                memguard_unguard_range(p, PAGE_SIZE);
+                clear_page(p);
+                memguard_guard_range(p, PAGE_SIZE);
+            }
+            else
+            {
+                p = map_domain_mem(pfn << PAGE_SHIFT);
+                clear_page(p);
+                unmap_domain_mem(p);
+            }
         }
         
         spin_unlock_irqrestore(&heap_lock, flags);